home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
029a
/
sprbrow.zip
/
BROWZE.DOC
< prev
next >
Wrap
Text File
|
1991-06-13
|
3KB
|
57 lines
Fancy Browsing
Once upon a time, creating pop-up pick lists was a tedious
task. You had to select the file, define the fields that would be
shown, control what each keypress would do. It took even more pains
to define the labels that would appear over the fields and format
calculated fields if you used them. Unless you took the time to do
it properly, you had to create a new routine for each pick list.
With Foxpro's BROWSE command, these routines can now be created in
a matter of minutes. However, even this command did not do
everything. It let users select a record by using the positioning
keys (arrows, PgUp, PgDn), but it did not allow them to enter a
value. If the data file contained thousands of records and the one
desired was somewhere in the middle, the user would still have to
press the PgDn key many times. Y. Alan Griver showed us how to use
the On Key Label function to enter values during a browse. I have
used his concept here and included additional features such as:
1) making it a generic routine, callable with a few lines of code
from any program
2) allowing the use of files which are non-indexed, indexed or
indexed on multiple fields
3) having it work identically on character, numeric or date
fields. It will search from the leftmost characters entered. A 7
will find the first search field beginning with 7. (7, 70-79,
700-799). Naturally, this search will be slower than an indexed
seek.
4) allowing the user to add a record to the file, if the
programmer permits it.
5) display of the search key being built and the field being
located for that value
6) selecting multiple records with one call to Browze
7) allowing the search to work on any field in the browse that
belongs to the active database. If the user moves the cursor over
to the next field, (and that field exists in the active database)
any previously entered search value is cleared and the locate for
the new search value entered will take place against that field.
However, only the first field in the browse list can be SEEKed.
This feature must be disabled if the browse uses the key clause,
where only records for which the index key matches a specific value
are shown. The reason for this is that the locate might match a
record with a different index value. Since the located record would
not appear in the browse, it would confuse the user.
I use this routine in all my programs to allow the user to
select records from a pick list. The program TEST demonstrates
various uses of BROWZE including using it to select multiple records.
By passing an third parameter of .t., the return key no longer selects
the record and exits, it selects the record, moves down to the next
record and waits for another record to be selected, the ESC key to be
pressed to cancel or F2, signalling the end of the selection process.
Pressing return also resets the search key to blank, so that it is ready
for the next search value.
I am sure that once some of you power users start playing
with this, you will find ways to make it faster, easier and more
powerful. I would appreciate hearing from you.
(Yisroel Goodman is Complete Computer Services, Inc. He lives
and works in Far Rockaway, NY. When not designing and coding, he is
working on other projects, such as Shayna and Dani. He can be
reached at (718) 868-3000 or on Compuserve 70243,443)